package edu.upc.autopartescybershop.web;

import edu.upc.autopartescybershop.domain.Solicitud;
import edu.upc.autopartescybershop.service.SolicitudService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Carlos
 */
@Controller
public class PedidosController
{

    @Autowired
    private SolicitudService solicitudService;

    @RequestMapping(value = "/pedidos.htm", method = RequestMethod.GET)
    public ModelAndView listadoPedidos()
    {
        ModelAndView mav = new ModelAndView("pedidos");
        List<Solicitud> solicitudes = solicitudService.obtenerSolicitudes();

        mav.addObject("listadoPedidos", solicitudes);

        return mav;
    }
}
